Any course/module you teach in Moodle has the option of creating groups for participants. You can then use those groups (if you wish) in any of the Moodle activities.
This could be for group assessments, but it could also be for forum discussions so that the discussion is deliberately between a small number of people. However you can also use groups to allow mutiple cohorts of people to use the same Moodle course at different times. So if you have a course with say 4 weeks of material, you could allow one cohort to start in January as one Moodle group and then another to start in March and the two groups would not mix together (unless you wanted them to).