As Terry Mason pointed out, the main difference is the headlight (the most obvious, not the main, really). Just as there are a lot of different versions of the CJ, there are different versions of the YJ (not necessarily by number as in the case of the CJ).
The main differences between YJ's are in the engine and roll bar. The first few years, the YJ had a rollbar similar to the CJ, but after the early 90's (dont remember the exact year), they extended the roll bar (or rather the "sport bar" as it is properly called because of the lawsuits!) to protect the rear passangers. The engines also went from Throttle Body Injection to Multi Port Fuel Injection (again, cant remember the year, but it was sometime in the early 90's if I remembr correctly).
Traditionally speaking, the CJ's have more appeal because they are the "original", but the YJ is a bit more capable in the stock form (leaf springs are a bit wider, engines are a bit more efficient because of EFI, etc.). A lot of people dont like the YJ's because they say square headlights are not "Jeep" (whatever that means; I personally love the square headlights!).