The fact that it resembles brain structure, is that also because of gravity or is it a combination of both gravity and electromagnetic force, Wat?
The similarity between appearance of the cosmic web and neurons in a brain is a coincidence.
The cosmic web forms purely by gravity. Electromagnetic forces are negligible on that scale. This is because there are positive and negative electric charges, and the electromagnetic force is so strong that opposing charges met up very quickly after the Big Bang, so that on large scales the universe appears electrically neutral. Gravity on the other hand always attracts, but it is weak, so it takes more time for material to gravitationally clump together and form the web structure.
The shape of the structure also doesn't depend very much on whether the force obeys an inverse square law, cube law, linear, or whatever. That will affect how quickly it forms, but the shape will work out about the same. For a proof of this, refer to my post a while back on the
boids algorithm. In the 3D simulation, you may notice how at first the boids form a structure which (briefly) looks a lot like the cosmic web. This similarity is
not coincidence -- the structure in both cases forms because of mutual attraction of nearby particles. In the boids algorithm case, the attraction law was proportional to the distance (up to some cutoff where boids no longer sense each other), quite unlike the inverse square law of gravity.
Of course, the similarity breaks down after the boids are clumped together. Then the other two rules of the boid algorithm become important, and the structure behaves like moving flocks of birds.
In the case of the brain I thought it was more EM since gravity would be negligible on that scale, but could it be a composite of both?
I would say
neither. While the electromagnetic force is what forms bonds and interactions between the particles, it is not what governs the growth and shape of the structure. The neural structure of the brain forms the way it does for evolutionary/biological reasons, as it presumably optimizes the storage and transfer of information within brains. The instructions for creating it are carried in the DNA. There's probably a whole lot more that can be said about how that works, but I'm an astronomer and not a neuroscientist.