There are books on this subject. They can be found at most public libraries.
Although a lot depends on the specific program, the general idea is to concisely summarize who you are, what is unique about you, and how the program connects to your identity and goals in life.
If you are applying to a program that gets lots of applications, it helps to begin the essay with something that will stand out, such as, "When I was an autistic child in a small special education classroom in Alaska, I never imagined that I would one day be applying to a PhD program, or that my fascination with light switches would develop into a life-long passion for electrical engineering."
No matter what, be sure to use excellent grammar, show off your vocabulary (even if you have to use a thesaurus), and show that you can write in a concise manner. When you go from undergrad to grad school, you trade in minimum page lengths on papers for maximum page lengths (or word counts). They like applicants who already know how to say as much as possible in as few words as possible while remaining engaging and grammatically correct.