You can use erig_replace() or eregi_replace() on the found string to "highlight" the found keyword. For instance, if the keyword is $keyword and the matched text is $matched_text:
$pattern = "($keyword)";
$replace_string = "<font color="#110000">\1</font>";
echo (eregi_replace($pattern, $replace_string, $matched_text));
The concept of determining the "relevance" or "accuracy" of the match as a percentage depends on the type of matching you are doing and the complicated algorithms used for searching. It probably isn't even appropriate for a simple keyword search; you would be more accurate just to count the number of times the keyword was found in each document.
HTH
-- Rich Rijnders
-- Irvine, CA US