Some languages, like PHP, allow for HTML markup to be mixed with code in the same file. When the caret is inside a block of code (not markup), the program shouldn't be matching tags and highlighting attributes.
Without implementing a real parser for PHP, ASP and JSP it's not possible to determine what is "code" and what is "markup", but the patch should make it a bit better. It fixes the problem in bug 4453, but there are still some pathological cases left, like:
<sometag someattribute = "<?"> <sometag someattribute = "?>"> </sometag> </sometag>