In the books they only clear the ships from the Corsairs. In the film they win the entire battle and scour the city of Minas Tirith. It is [imo] the one and only inexcusable change from the books to the films. Every other one I can live with, including Faramir, but not that one. It robbed the men of the victory and gave it to a bunch of ghosts who prior to the film had no part in the story.