This function will return highlighted, xhtml 1.1 valid code (replaces <font> with <span> elements and color with style attributes):
<?php
function xhtml_highlight($str) {
$str = highlight_string($str, true);
//replace <code><font color=""></font></code>
$str = preg_replace('#<font color="([^\']*)">([^\']*)</font>#', '<span style="color: \\1">\\2</span>', $str);
//replace other <font> elements
return preg_replace('#<font color="([^\']*)">([^\']*)</font>#U', '<span style="color: \\1">\\2</span>', $str);
}
?>