I'd second Ahruman's advice - particulary looking at Uli's UKSyntaxColoredTextDocument as that will point you in the right direction as to which classes etc. you are going to have to learn about.
This is another excellent source of information:
http://www.cocoadev.com/index.pl?ImplementSyntaxHighlighting
Good luck - Syntax highlighting is hard to get right, but lots of fun along the way!