The W3C Validators let you know if your site code adheres to the World Wide Web Consortium's open web standards. These rules are a set of guidelines that web browsers are suggested to follow to make sure that what developers code appears consistently similar throughout different browsers. The different sets of rules you can follow are specified by your page's DOCTYPE. Following these rules would ideally get your site looking and acting the same in any browser that respects said rules.
I can't speak to other search engines, but at this time invalid code does not directly affect page ranking for Google.
W3C is the guidlines of creating website and standers which is follow by the website developers . Most Web documents are written using markup languages, such as HTML or XHTML. These languages are defined by technical specifications, which usually include a machine-readable formal grammar (and vocabulary). The act of checking a document against these constraints is called validation, and this is what the Markup Validator does.
Validating Web documents is an important step which can dramatically help improving and ensuring their quality, and it can save a lot of time and money (read more on why validating matters). Validation is, however, neither a full quality check, nor is it strictly equivalent to checking for conformance to the specification.