Well, as you know you cannot put anything that needs evaluation directly into the matchtext. So you need to use $() to ensure evaluation.

So whatever you put between $() will first be evaluated rather than to match the actual variable text.

on *:TEXT:%myvar: will match on the actual word "%myvar" while if you $eval it like

on *:TEXT:$(%myvar): %myvar first evaluates to whatever value it holds, and then mIRC compares it to see if there is a match or not.

You can put identifiers in there as well:

on *:TEXT:$($+(*,$me,*)):#: echo -a Someone mentioned your nick