Create a file in the groups format used by yum
Tell createrepo to include that group file in your repository.
You can either open a text editor and create the groups xml file manually or you can run the yum-groups-manager command from yum-utils.
Run the groups-create command like this:
yum-groups-manager -n "My Group" --id=mygroup --save=mygroups.xml --mandatory rpm1 rpm2
And you'll end up with a file like this:
glibc rpm yum
To include this in a repository, just tell createrepo to use it when making or remaking your repository.
createrepo -g /path/to/mygroups.xml /srv/my/repo