Yes, instead of
use:
Just replace X,Y;Z with the ID's of your groups.
if (is_member(X, $account['uid'])) continue;
use:
if (is_member(array(X,Y,Z), $account['uid'])) continue;
Just replace X,Y;Z with the ID's of your groups.