There is, but it's complicated. You can use [gids] but it will be an array converted to a string with values separated by |*|. It's usually best to use the IF substitutions to check for usergroups as it deals with the array handling for you. Example as follows.
[cb:if usergroup includes "2"]I have Registered Usergroup[/cb:if]
Correct, you cannot use PHP there only SQL. That will directly add to the WHERE statement of the query.