You have C# code in a .js file. If you want to develop in C#, your file extension should be .cs.
The other posters have noticed that your C# syntax was unusual, but fixing that won’t let you compile because Unity’s sending the file to the wrong compiler. Fix your extension and that part of the problem will be fixed.
using UnityEngine;
using System.Collections;
public class EndOflevel : MonoBehaviour {
void OnTriggerEnter(Collider3D other)
{
if(other.gameobject.tag=="water")
{
Application.Quit();
}
}
}