Communities will be given more opportunities to build homes in their neighbourhood, thanks to a new £4m government grant programme.