The task pane is pure HTML. It can do anything that HTML can do, including use script, CSS, dynamic HTML, AJAX, or whatever.
Use of the word "highlight" is throwing me off. Do you mean like a yellow background color on the text that was clicked, or do you mean switching views? The answer to either is "Yes".
A task pane can call into the XDocument object through the window.External object. There should be plenty of resources available that show how to do this.