Helium and beryllium both have the same number of valence electrons. Then why is helium inert?
Helium is inert because it's outer electron orbit has 2 electrons, the maximum it can hold.
Beryllium has four electrons. The first two are in the inner orbit (same as He) and the other are in the outer orbit that can hold eight electrons. Therefore, Be can either donate these two electrons, or accept 6 electrons from another element to achieve a complete outer orbital. The ability to "make a deal" in either acquiring or donating outer orbital electrons is the hallmark of a reactive element.