A JSON (or whatever) file could be used for that, but you'd need to implement some sort of file-locking process, so that only one user can update it at a time. (Lock file, read file, parse into PHP array, add new score, sort array, trim array, parse back into json text, overwrite file with new contents, unlock file.)
A database solution would remove that concern. All you would need to do is write a new row to the DB, and whenever you want to show the high scored, just do a DB query with an
...order by score desc limit 10, for example, to get the top 10 scores.