Hello Liggie,
for exemple with the native SEBLOD Article Manager, and you want to modify the Category Filter:

In the Before Search script, you can dump the variable $fields.
You will see something like that:

If you dump the field $fields['search']['art_catid'], you can see the property "Form":

So, you can construct the form here.
If you are using a Select Simple, by default, add all cases in the select, and then depending on groups, you can remove unwanted options with something like that:
if ( ... ) {
$fields['search']['art_catid']->form = ' aaa '
} elseif ( ... ) {
$fields['search']['art_catid']->form = ' bbb '
} else....
Hoping it will help.
Regards.