The HTML5 grammar is only defined by the tokenizer specification from WHATWG. However, the document is really not practical so we developed our own (clickable) version of it.<p>Blog entry w/ code on github: https://communities.coverity.com/blogs/security/2013/01/23/a-new-look-into-the-html-5-tokenizer-specification<p>Online document: http://www.coverity.com/srl/html5-grammar-visualization.html