Each of those groups is called an option name. You add two option names for your scenario, one color and the other size.
As part of this, you determine how you want to present the option values. More than likely either as a dropdown or radio buttons. You also assign a sort order for the option names so if you want size first, then give it a lower sort order than color but keep them a positive number.
Then after the option names are entered, the option values (all possible values that could be applied to that option name) are entered in the option values manager. It is suggested that a value be included such as please select a size (for the size option name) such that when options (attributes) are presented to a customer this option is the default display only attribute requiring one of the other values to be selected before adding to the cart.
After that, the attribute manager is used to populate the attributes to the individual product. Yes, when selecting size or color, there may be values available in the list that are not applicable to the product. Only select those values that correspond to the product.
That should be a brief synopsis of what was read in the link (provided twice) above.