Dear Amira,
You forgot to mention the state you are based in and your role in the organization. You can specify in the appointment/joining/offer letter that "You understand and affirm the need to treat your compensation as highly individual and confidential, which is to be discussed only with your HOD and/or HR/People Manager."
Apart from this, I am not sure you can hold the employee against any legal law. This is an employee's moral and ethical responsibility to keep his remuneration offered confidential. Whatever you may say to the employee, after some time of joining, he will discuss his salary with his colleagues just to compare. It is the job of the respective HR Professional to make an employee understand and convince as to why he has been given a particular package. This process should be based on transparency rather than concealment.
There could be many differences among two individuals starting from Educational/Professional Qualifications, respective ranking of the institutes from where they have completed their education, level and tenure of experience to technical know-how. Apart from this, their performance, skills, and capabilities, both technical and behavioral, displayed during the interview, are a single most important point where an employee is judged before receiving an offer.
Regards,
Sourabh