Three masts of different sizes
At the time of the sailing navy, when this mode of propulsion was the main engine of the boat, mainly three-masted sailing boats were used. These tall ships carried a foremast, in the centre the mainmast and behind the mizzen mast.
If the tall one was the tallest, the foremast often exceeded the mizzen mast.

Square sails give their name
These sailboats were wearing square sails. These are sails established on yards that had square shapes (more precisely trapezoidal). Yards are the spars established horizontally. The sails are rigged underneath.
Thus we speak of three-masted square masts when we present sailboats of this type.

What about the three-masted barque?
Depending on the rigging, the mizzen mast may or may not have square sails. The mizzen sail is an auric sail built on a boom and horn (not a yard) that most closely resembles our modern mainsails.
A three-masted barque will therefore not have any square sails on its mizzen mast. Belem is undoubtedly the most emblematic of all.

And when there are more than 3 masts?
Most 19th and 20th century sailboats had three masts. But there are other sailboats with four or five masts (or more!). In this case, we simply speak of four square masts (or boat) or five square masts (or boat) depending on how the mizzen mast is rigged.
The France II built in 1911 (the largest sailing ship 150 m long) is a five-masted boat, because its mizzen mast does not carry a yard.