There's no easy / waterproof way to catch *all* possible highlight situations (have e.g. a look
here) .
Anyway, you'll catch the most of *regular* highlight situations if you use this condition in both an "on text" and an "on action" event:
if ($highlight($nick $1-) { your code to add text to a custom window }