That "diaphragm" is supposed to expand/open like that when the fluid level drops to take up some of the empty space so that the brakes can still operate like they should, as opposed to squeezing the "air in that space" and the fluid.
(this is the best way I know to explain it, hopefully its somewhat understandable)
But the point is, it's supposed to expand as fluid goes down, and when you refill the fluid, you're supposed press the folds back together.
If you filled the MC without closing the diaphragm back together, then putting the cap back on would force the fluid up and out over the side of the MC, so you will have fluid all over at that point.
Make sure the fluid is full, the diaphragm is closed up and the cap is tight. Then take a rag, and even some Q-Tips and clean the MC all around the lid, the base-everything really well, and after a few uses, it will be pretty easy to tell where the leak is coming from.