The Role of Environment in Galaxy Formation