When creating Contact Group, there's a small checkbox below the description "Condition-based contact group". You check it and then you'll see the UI to provide this condition.
Click on "Edit condition" then, and in Rule designer select "Contact is in role" rule, then configure it.