We communicate via radio, as you note, but it's not quite as hard as your question makes it sound. Don't get me wrong, it's still an amazing feat of engineering, but we can walk through how it's possible.
First, we can think of this by way of an analogy. You might think that this is like being in a stadium at night, with huge, bright, white lights shining down from on high, and you're trying to pick out someone with a tiny pen-size flashlight who's shining it from right next to those big lights. But, that's not a good analogy. Instead, we use radio wavelengths that are relatively quiet so far as most other signals from the cosmos are concerned. So, it's more like you have those really bright stadium lights that only emit light from blue thru red, and you're shining a small ultraviolet light from it. If you have an ultraviolet filter, those bright stadium lights will effectively not even be on, and you can easily pick out the tiny ultraviolet light shining next to them.
Second, we have the issue of signal strength. When NASA (or ESA, or another space agency) transmits a signal that they want to picked up by a spacecraft, that signal is extremely powerful. The antennae can transmit a signal with up to roughly 20 kW (see, for example, this other StackExchange question). Enough power to run a large house, all concentrated into one radio signal at a very, very specific frequency. These transmitters are exceedingly good, varying by less than 1 part in 1,000. It's similar to why a 5 milliWatt green laser pointer can look so bright, but a 100 Watt light bulb is a comfortable reading light: All that power is concentrated in just that specific frequency (this isn't a perfect analogy, since it also has to do with how your eye focuses light).
Third, how much information can be transmitted per unit of time (like per second) is then based on how much you can divide that power up and still have it received by the spacecraft. If you divide that 20 kW signal up into 20 pieces per second, you're sending 20 bits per second, and each bit has 1 kW of power in it upon transmission.
Fourth, the light certainly spreads out and attenuates as it travels, following the inverse-square law, and so we have to design the receiver antennae on the spacecraft to be able to detect those small signals above the level of background noise. If the spacecraft is farther from Earth, we have to decrease the bit rate so that each bit has enough power in it to be detected. The received power is often expressed in dB (decibels), like sound. I don't have numbers for Mars craft, but I can tell you for New Horizons, at Pluto, with a 10 kW signal, the antenna would get a signal of about 50–55 dB, which is well above the background noise from any other sources. If it were sound, that's a normal household conversation level of sound.
Fifth is getting a signal from the spacecraft to Earth. Perhaps obviously, the transmitters on these spacecraft don't have 10s of kW to put into their signal. Instead, they have to rely on two things: Lower the bit rate so that each bit has more power in it, and rely on the Deep Space Network telescopes being bigger and so able to detect weaker signals than those spacecraft can. The Deep Space Network 70-m dishes themselves can detect signals in the pW range (picoWatts, or 10-12 Watts) before it gets lost in the noise, provided that that signal is similarly transmitted at a wavelength that other random cosmic sources are not loud on. If I'm doing my conversion correctly, 1 pW is -90 dBm or -120 dBW (dB referenced to 1 mW or 1 W of power).
The math is then reasonably straightforward to say: (a) You can transmit with a certain total power, (b) you can receive signals of a certain minimum power, (c) that total power is going to drop by a certain factor based on how far away you are, (d) so then how much can I divide that dropped power by in order to get my bit rate?
This is why New Horizons when it was near Pluto was transmitting data at around 1300–2400 bits per second, but right now, the bit rate is closer to about 600–700 bits per second, as the craft is about 5 AU farther away and it has less power to put into its transmitter since its Plutonium power source has continued to decay.
Specifically with rovers, those dishes are often smaller and rely on orbiting spacecraft with larger dishes to receive signals from Earth and transmit signals to Earth, effectively as a relay between Earth and the rover.
And, telescope diameter is what's used, so edge-to-edge "as the crow flies," as opposed to how the ant walks.
P.S. I helped design this infographic / information pamphlet for New Horizons that covers a lot of this question.