Ping, or latency, is the time it takes for a message to travel from your game to the server and back, measured in milliseconds (ms). It is not about how fast your internet is for downloads; it is about how quickly the server reacts to what you do.
Survival, creative and Skyblock are forgiving; PvP, Bed Wars and Parkour are where low ping matters most.
Data travels through cables at a limited speed and passes through many routers on the way. The further away the server is, the higher your ping, and no setting can remove that. A player in Europe will usually have low ping to a server in Germany and much higher ping to one in Australia. Big networks sometimes run servers in several regions for this reason. Server pages on CraftRank show the country where the server is hosted, so you can pick one close to you.
In the Java Multiplayer screen and in the player list (hold Tab), Minecraft shows ping as signal bars. Full green bars mean low ping, and fewer bars mean higher ping. Hover over the bars in the server list to see the exact number in milliseconds. A red cross means the game couldn't reach the server at all.
The bars are a rough guide: they are based on a single quick measurement, so one slow moment can drop a bar. Look at them a few times before you judge a server.
If ping is fine but the game still stutters, the problem is FPS or the server itself. See how to fix lag on a server.