Here's why:
* Participles are words that are formed from verbs and act as adjectives.
* In this case, "visiting" describes the ships, telling us that they are the ones that are doing the visiting.
* The full verb phrase would be "ships that are visiting".
Therefore, "visiting" modifies the noun "ships" and functions as an adjective.