selecting something would be possible by having a "selected" boolean private variable you set to true if the unit is selected.
you just have to foreach the units and check for these variable set to true and apply your actions.
To group, you could have a 2 dimensional array sized this way :
DIM X = maximum number of groups
DIM Y = maximum number of units per groups
and then you select the units you want to group (that is to say, their "selected" variable get set to true)
and when you use your shortcut to groupe them, you foreach them and store their UID in the arrayat(IDofTheGroup,loopindex)
If you want to recall your selection, you just have to do a
for 0 to DIM Y
if unit.UID == arrayat(IDofTheGroup,loopindex) -> unit set selected to true
I hope you have some knowledge of c2 else I might be a bit hard to understand... If you don't understand, you don't have enough knowledge yet to make a RTS I guess (: