The speed of sound in an ideal (calorically perfect) gas is given by
a = sqrt( gamma * R * T )
where gamma is the ratio of specific heats (thermodynamic property of a gas, which may vary with temperature), R is the individual gas constant, and T the temperature of the fluid. All of these are going to be different on Mars versus on Earth:
Earth:
R = R_atm = 287 J / (kg * K)
gamma = 1.44
T = 293 K (taking room temperature as an average temperature)
Mars:
R = R_CO2 = 188 J / (kg * K)
gamma = 1.37
T = 210 K (from a quick google, about -60 deg C)
If the Martian and Earth atmospheres were at the same temperature, then the speed of sound on Mars would be 80% that of the speed of sound on Earth. Given the temperature difference, the speeds of sound are
a_mars = 232 m/s
a_earth = 347 m/s
So yes, much of the difference is due to the composition: the Martian atmosphere has a higher atomic weight, which leads to a lower individual gas constant, and decreases the speed of sound. However, a substantial amount of the difference is simply due to the different temperatures on the surfaces of the two planets.