By using the optgroup element.
<select name="icecream" size="7" multiple> <!-- The size attribute indicates the size of the selection box in number of lines -->
<optgroup label="Traditional">
<option>Vanilla</option>
<option>Chocolate</option>
</optgroup>
<optgroup label="Fancy">
<option selected>Super praline</option>
<option>Nut surprise</option>
<option>Candy corn</option>
</optgroup>
</select>