For understanding why validation matters, it is needed to understand how a browser works at its different layers, and also a little bit about the history of web from the perspective of web browsers.
The HTML you give to a browser is interpreted by the browser following the DOM, an application programming interface that maps out the entire page as a hierarchy of nodes. Each part of that tree is a type of node containing different kinds of data. DOM (Document Object Model) was necessary because of the diversity of HTML pages that early web browsers (Netscape, IE...) implemented to allow alter the appearance and content of a web page without reloading it. For preserving the cross-platform nature of the web, W3C wanted to fix the different implementation of those browsers, proposing DOM.
DOM support became a huge priority for most web browsers vendors, and efforts have been ongoing to improve support on each release. So, it worked.
DOM is the very basic step with which a web browser starts. Its main flow is:
- parsing HTML to construct the DOM tree
- render tree construction
- layout of the render tree
- painting the render tree
The step 1 gives the content tree, with the tags turned to DOM nodes. The step 2 gives the render tree, containing styling information.
So, why validation matters: because content tree and render tree are the basis from which the web browser start its job. The most they are well defined, the better for the web browser.
Ultimately, the DOM is also the basis for your JavaScript events. So, its validation helps to the interaction layer too.