I could be misremembering (I don't have my rulebook handy) but I thought when you grapple that you're considered to be in the same square as your opponent. In that case, there is no opposite square from which to gain flanking, there is just an adjacent square with an ally in it.