I'd recommend you visit www.svsarah.com
where you'll read some of John's posts about cruising in the Med, and you'll also find a few things from me in the WHOOSH link - e.g. discussions on VAT and Schengen (Immigration). In general, there are many non-EU boats and cruisers in the Med and dealing with the rules generally boils down to the following:
1. The EU countries there are Schengen signatories. This means they do not permit presence of a non-Schengen citizen inside their combined
borders for more than 90 days in a 180 day period. In practice, this is not enforced this way by the officials but one is generally expected to leave a given country after 90 days unless seeking an extension to one's visa. While cruising, this is not often a problem...and if it is, ferries and trains are everywhere and you can take a day trip outside the border to have you passport restamped on your return.
2. VAT is applicable - if the officials think to look for you - on all non-VAT paid vessels who remain inside the EU for more than 18 months. Consequently, we all step outside the EU on occasion and get paperwork documenting that fact, which we then keep available if visited by the officials. VAT scrutiny is not common except on the French Atlantic coast. VAT is usually around 17-20% of the official's evaluation of the boat's value, so you definitely want to avoid it. Morocco, Tunisia, Croatia, Turkey and the VAT-free zones of the Channel Is. and Gibraltar are all commonly visited locations for 'restarting one's VAT clock'.
3. Clearing in/out is generally not done when moving from one EU country to another. Greece is certainly an exception, where they seem to have much paperwork and each harbor has its official(s). I would recommend on arrival (perhaps Lagos, Portugal - a popular stop before entering the Med) that you do the normal clearance (customs & immigration, most often done by the marina on the S coasts of Portugal and Spain, so no special visits to the authorities), and then not worry about clearing in/out as you move thru the other EU countries. OTOH when visiting a non-EU country - e.g. you hop over to visit Morocco from Gib, or visiting Croatia, Turkey - then assume formal clearance in/out to be the norm.
Good luck on the run; keep an eye out for our 13m ketch once you arrive...and Welcome!
WHOOSH, lying Gzira, Malta for the winter