There currently isn’t built-in support for option groups in Gravity Forms.
In the meantime it is possible to use the gform_field_choice_markup_pre_render
filter to change some choices into opening and closing optgroup tags:
On the field in the form editor configure the choices like so:
label | value =============== group one | optgroup-start choice one | choice 1 choice two | choice 2 choice three | choice 3 end group one | optgroup-end group two | optgroup-start choice four | choice 4 choice five | choice 5 choice six | choice 6 end group two | optgroup-end
When the field is being displayed the code snippet will handle replacing the HTML for those choices with the optgroup-start and optgroup-end values with the correct option group HTML tags.