BCl3 and AlCl3 both are the electron deficient compounds, as there are only six electrons in the valency shell of central atom after the formation of the molecule. So,both the compounds have strong tendency to gain two electrons, so that their octet is complete.
The electron deficiency of boron in BCl3 is compensated by formation of co-ordinate bond between the lone pair of peripheral chlorine atom and the empty unhybridised p-orbital of Boron atom, forming pn - pn bonding (Back bonding). So, the electron deficiency of BCl3 is compensated by formation of pn – pn bonds within the molecules hence halides of boron i. e., BCl3 do not form dimer.
However the electron deficiency of Al-atom in AlCl3 is compensated by formation of co-ordinate bond between lone pair of chlorine atom of another AlCl3 molecule and the empty unhybridised p orbital of Al-atom. So, AlCl3 forms dimer as Al2Cl6.