Ground and neutral should only be connected in your main distribution panel and never at a subpanel, junction box, outlet etc.
The reason for this is mainly to ensure that GFCI and AFCI circuits work properly but also simply because the neutral line has a lot of current flowing over it and is essentially more likely to develop a fault that could shock you as a result. Because ground is not normally involved in the current path of your devices, it is far more likely to stay at a lower voltage than neutral in the event of a fault. In all honestly if you don't have GFCI or AFCI, it should work and it is not LIKELY to cause harm to you, but there is no benefit to having it installed incorrectly.
If you have a ground wire going to the neutral line in your subpanel then yes, do move it to ground. If it is supposed to be a ground wire. Some outlets have all 4 wires going to them and would really have a neutral even with 240v and that's fine. Such outlets would also have a ground which is separate from the neutral until it reaches the main distribution panel.
This isn't really a definitive answer as I don't see any info about how the compressor/outlet are wired on the other side. But in general, again, keep your grounds and neutrals separate in subpanels.