Group By... options are created in the XML definition of the Search view.
First, collect some information you will need:
- Make sure you are in Developer
mode (1) and your user is in
the group Technical Features (2) 
- Navigate the menu sequence - 
  - Sales -> Customers 
 
- From the Debug View# menu, select Edit Search View 
- In the window that pops up, you can
see the definition of the base view,
including the <group> tag at the
bottom containing Salesperson,
Company and Country. (Technically you could edit this view, but the next time you upgraded the module, or upgraded the software, your edits would be overwritten) 
- Note the name of this view -
res.partner.select - and the object
is is defined for - res.partner -
and close the window. 
Now, you need to make your own view that inherits the view you found and adds to it.
- Navigate the menu sequence - 
  - Settings -> User Interface -> Views 
 
- Find any Search view, open it and click Duplicate from the More menu. 
- Name the view.  Something like custom.res.partner.groupbystate for
example. 
- The Object is res.partner and the Inherited View is res.partner.select 
- Your XML will look like this: 
<?xml version="1.0"?>
<filter string="Country" position="after">
<filter string="State" context="{'group_by': 'state_id'}"/>
</filter>
For more information:
(1) https://accounts.openerp.com/forum/Help-1/question/83/ 
(2) https://accounts.openerp.com/forum/Help-1/question/1276