This is a very broad question. A good comedy, drama, or even "reality" tv show are going to have different characteristics that contribute to its perceived quality. But I would say that in general quality programs will have the same basic characteristics as a good movie, book, or other form of story-telling media:
- memorable characters who feel "real" and make you care about what happens to them.
- a plot that makes sense and isn't full of holes that anyone with half a brain can see through.
- the show makes you think about what happened after it's over, makes you want to discuss it with others
- its entertaining and engaging enough to keep you watching and waiting for the next episode to air