Adding a compressor to a ramjet powered by a turbine in the exhaust allows increased combustor inlet temperature, and a consequent increase in possible thermal efficiency. The turbine however is limited in the temperature it can handle, so maximum power is also limited.
In the T-S diagram below the presence of the compressor allows us to raise the combustor inlet temperature (3). The raising of the combustor segment increases the cycle area and the thermal efficiency.
Addition of an afterburner (5-6) allows thrust augmentation as can be seen from the increased area of the diagram shown below. The afterburner operates in the higher entropy range and has lower efficiency than the base turbojet.