I don't really get the problem you are having. You already answered your question yourself. Add a `mapping(uint => uint) mintGroup` or whatever variable type you need to map the specific `tokenId` to the group.
Transfering the token does not change its id and thus will not change the mapping.

You could also add it as a variable in the token itself but handling those is really uncomfortable in comparison to using `mapping`.