${BeF}_2: {Be}$ atom has two electrons in its outermost shell. Each fluorine atom is short of its octet by one electron. Thus, there are two bonding pairs of electrons around Be. As a result, ${BeF}_2$ acquires a linear geometry.
${CH}_4$ : Carbon atom has four electrons in its valence shell. Each hydrogen atom has one electron each. Thus, there are four bonding pairs of electrons around the carbon atom. These four pairs of bonding electrons gives tetrahedral geometry for the ${CH}_4$ molecule.