There are many variations of HTML with various names; XHTML, DHTML etc... Your browser will do its best to work out which variation your document is written in but may not always get it right. Particularly in IE it will default to "quirks mode" if you do not declare a doctype which frequently causes most of your layout to break.
Declaring the doctype means the browser doesn't have to make this best guess and instead, it renders your page according to the specification related to the doctype you have declared.
Here are some interesting articles on the differences between some of the DTDs: