If you do not want to show one or more of your group memberships in your profile, you can specify this in the profile management under 'My groups' (Settings).
Note: Forum posts in hidden groups are still displayed in the profile. However, the view is limited, so only a maximum of 30 pages or a maximum of 1-year-old posts are listed in the profile. If a topic in a group is set to private, this is of course only visible to group members.