They don't look overly big, likely they been living together as a "juvenile group" so far and they just start to feel the motivation to shift into roles.
I don't think there are preset rules, it's not like they both know that the big will be the female and they just both accept this (they might not even know who is the bigger as they don't see themselves lol), many times they will fight it and the future male only accepts he is inferior after a few proper beating.
Normally ofc the big one wins these fights, well, after all it's bigger, been more agressive going for food so far, and the small one will be forced to be the male.
Now if in your tank the smaller thinks he is gonna be the female, just grab popcorn and prepare yourself for an eventful 3-6 monhts...