I have found this thread for BW. It doesn't help with BW2 but it sheds some light: https://projectpokemon.org/home/forums/topic/54940-editingcreating-a-game-sync-id-in-gen-5/
There are no flags or settings related to this in PKHex and BW Tool.
I have tried dumping and injecting all the blocks with PKHex into Black 2 but nothing. I have also tried comparing the two saves to no avail.