It is important to grease a baking tray before baking cookies or any other baked goods because it helps prevent the baked goods from sticking to the tray, making it easier to remove them without damaging their shape or texture.