You can locate an optgroup like any other element. Then you can search within that group for your option.
browser.optgroup(:label =>'env2').option(:value => 'comp1').select
Update - It looks like there is a bug in watir-webdriver that prevents the above from working.
When creating the locator for the label, watir-webdriver calls the following method:
def should_use_label_element?
@selector[:tag_name] != "option"
end
For the optgroup, this returns false, which means that watir goes and looks for an associated label element (rather than checking the attribute).
As a temporary workaround, you could use css:
browser.element(:css => 'optgroup[label="env2"]').option(:value => 'comp1').select
A bug has been created for this issue (see Issue 219).