The <!DOCTYPE> is a declaration which must appear before any other html markup.This is an instruction to the browser about interpreting the html markup by specifying the version of the markup.The doctype declaration specifies the DTD to be used for HTML document.
In the case of previous versions of html the dtd to use needs to be specified in the doctype declaration.In the case of html 5 only following should be specified:
Contrast this with previous versions of html in which you need to specify dtd along in the doctype declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
DTD is Document Type Definition.It specifies the elements and attributes of a document.It is often used in different documents based on SGML such as xml.SGL is meta language on which other languages such as XML and HTML are based.For example you can specify valid elements in xml as:
<!DOCTYPE valid elements>
This was the case in earlier versions of html but in html5 there is no dtd.This is becasue html 5 is not based on SGML.Since browsers have rendering engine for correctly displaying html the support for dtd has been dropped in html5.