When doing a web search, you can get hundreds of thousands of hits that are totally irrelevant to your query. Your search engine, which deals only with literal strings of text, doesn't know the context of the text. That's because those documents have context programmed in, making Web searches and data gathering more specific. To do that effectively, documents have to be tagged.
Tags are attributes assigned to a piece of information.
Think of DTDs as rules of grammar, customized to each document, that dictate use of the document tags. So when you search the Web for Emily Dickinson, you won't get every instance of Emily and Dickinson, which could yield thousands of documents. Instead, you would get documents listing Emily Dickinson as an author. That differs from HTML, which gives only a Web address. If the address changes, it's much harder to get to the Web page.