A DTD performs a function analogous to that of a grammar: it formally defines what are the legal productions of a given markup language. Of course, DTDs can be as lax or as restrictive as any other kind of grammar: the designer of a DTD generally has to trade off generality of use with accuracy of error detection. The simplest kind of DTD would be one which did no more than specify a set of tag names, requiring only that every element tagged in a document use one of them. Such a DTD would of course be unable to detect errors such as <name>s occurring within <name>s or within <date>s, nor to prohibit such errors as register entries appearing other than inside registers. Creating correctly encoded texts with such a DTD would be rather like trying to speak a foreign language with the aid of a lexicon of the language, but no idea of its syntax (Burnard 1991, section 5.1).
In een formal element declaration in de DTD wordt de naam of Generic Identifïer (GI) van een element vastgelegd, geven de mimimization rules aan of het element al dan niet afgebakend moet worden door een start- en een end-tag, en beschrijft een content model in welke context een element kan voorkomen (Vanhoutte 1998, 114).
SGML and XML define the rules and procedures to specify the vocabulary and the syntax of a markup language in a formal DTD. Such a DTD is a formal description of, e.g., names for all elements, names and default values for their attributes, rules about how elements can nest, and names for re-usable pieces of data (entities). The TEI created not just one DTD, but a collection of tag sets (also known as elements sets or DTD fragments) which combine to one or more DTDs. Some of these tagsets are required, some are basic, and some are optional. The users of the TEI can select the convenient tagsets for inclusion in their DTD(s) (Vanhoutte 2004, 12).