You couldn't just replace the Magnesium directly without making other changes.
Taking beryllium as the first example.
In Plant-like organisms there are at least two different types of Chlorophyll, they work in pairs synergistically, one as an oxidizing agent and one as a reducing agent in the ATP and NADPH cycle (synthesis of glucose), (more on Photosynthesis). You would need to consider binding energies between the Mg+2 ion (Cation) and any corresponding Anion. Binding energies for beryllium are much higher, meaning you would need higher-energy photons to be absorbed by your new version of chlorophyll (let's call it NVC).
The thing about the chlorophyll molecules is that they have tails acting as antennas, tuned to a specific wavelength of light, corresponding to it's absorption spectrum. In the case of your NVC, you'd need to tune it to a higher frequency - ie. truncate the tail of the molecule, and in a wavelength-specific way.
The electromagnetic spectrum is shown in this table, higher energies (shorter wavelengths) nearer the top.
I'm not enough of a physical chemist to tell you how you can do this, but I can say that beryllium would likely lead to your plants needing ultra-violet and beyond energy photons, perhaps even into the x-ray spectrum to work, if it would at all.
Edit: calcium's binding energy turns out to be less than magnesium, perhaps a longer-tailed NVC is in order and absorption of infra-red light would be the method of photosynthesizing.