Some resources:
http://msdn.microsoft.com/en-us/library/aa370283(VS.85).aspx (Local Group Functions)
http://support.microsoft.com/kb/119671
I got some C++ code that wraps user and group creation like this:
LocalGroup* group = new LocalGroup( "TestGroup", "TestGroupComment" );
LocalUser* user = new LocalUser( "TestUser", "Pa$$word!", "TestComment" );
group->AddUser( user );
user->Create();
group->Create();
group->AddUser( user );
I can forward you this code if it may be of any use, but there is currently no support for adding groups to groups (should be trivial to add though).