Can an X-ray differentiate between fluid on the lung and pneumonia?

Yes. But a more sensitive test is a chest ct scan.
Yes. Chest xray is good for differentiating fluid from pneumonia; fluid may collect around the lung rather than in the lung (known as a pleural effusion). Also pneumonia can be very dense and involve a complete lobe of the lung whereas fluild may be more patchy. Clinical history and exam of the patient also helps to make sure the diagnosis is accurate.