I have created a Sandbox-solution for SharePoint Online at the website http://permsetup.codeplex.com. As default when we share a site collection or site with external users, SharePoint Online show default SharePoint groups which are Visitors and Members. By using this feature, you will get a link which you can use to customize the default groups to your custom groups and other default groups.
Download the Documentation and read the article to see the feature settings:
After installation and activated feature: