First Batman reveals his fascist, Ayn Rand styled ideology in this because Zack Snyder is a teenager at heart and thinks might makes right sounds awesome. Then after Batman is finally going to stab Superman where he turns this into some stupid macho pissing contest BS with, "You aren't a god, you aren't even a man," he hears Martha and is like "Did we just become best friends? YEP!"
It is such terrible storytelling that a massive coincidence--that both their mothers are named Martha--can cause him to change his entire motivation for the whole film on a dime when it is most convenient to the plot.
In short, it is awful storytelling and awful characterization to boot.
I'm not sure you got the movie because their mothers being named Martha is not the sole reason of Batman's change.
As far as the "macho pissing contest"...
I see Batman as an alpha male. As an alpha male, i can see why Batman would try to enforce his superiority on another alpha male. Batman sees Superman as a threat, but he also sees him as someone who makes him feel powerlessness, something he has trained his entire life not to be. In a more human incarnation, i can totally understand why Batman would be portrayed as a more flawed character who, like any human being, can see himself in a situation where confusion, fear and certain questionable emotions makes him behave in a less honorable way.