These grid topologies refer to structured meshes. Unstructured meshes are a different technology with different pros/cons, I won't discuss them here.
A mesh must have adequate resolution to resolve all the flow features of interest using the numerical methods of the chosen tool.
Low quality cells can adversely impact a solution. For structured meshes, this usually means highly non-orthogonal (or skew) meshes. It can also have to do with how quickly the mesh resolution changes in a given direction.
2D Structured meshes can be represented by a matrix of points. X(I,J) and Y(I,J). You can easily move from one point to the next by indexing in the I or J direction -- i.e. move from XY(I,J) to XY(I+1,J). If I starts at 1 and runs to N, then those values of indices are valid I[1,N] no matter the J. Likewise, if J[1,M], those values are always valid. I.e. there are no holes in IJ space, no gaps, etc.
This means that the mesh has NxM points in it. If you increase the number of points in I, those points exist for all J. This means that if you need to add points in one region to resolve the flow, you might end up with extra points somewhere else that you don't need.
A very simple topology is the O-grid, you might think of it as a circle grid.

In the O-grid, the I=1 line is the airfoil and the I=N line is the outer boundary. The J=1 and J=M lines are coincident, and usually are chosen to start at the trailing edge of the airfoil and travel downstream from there.
Another simple topology is the H-grid. It can also be thought of as two grids together -- a top grid and a bottom grid.

In an H-grid, the I=1 line is the bottom boundary, the I=N is the top. The airfoil surface is found along I=N/2, with that line being duplicated or split somehow to represent both the top and bottom surfaces.
The left boundary is J=1 and the right boundary is J=M.
A third common topology is the C-grid.

Here, the I=1 line is both the airfoil and also the split line starting from the trailing edge and extending downstream. The I=N line is the top, left, and bottom of the outer boundary. The J=1 line is the top half of the vertical boundary and the J=M line is the bottom half of the vertical boundary.
If you are doing a viscous solution, then you typically need a lot of resolution in the boundary layer. The O and C grids here depict this situation.
With a C grid, when you have a dense boundary layer, you also automatically get a dense wake downstream of the airfoil. This can be a benefit if you are interested in resolving the wake downstream.
If you imagine using a H grid and resolving a dense boundary layer, you would also end up with a region of very fine cells extending in front of the airfoil. Those cells are not needed and the solution would not be very efficient.
However, if you use an O-grid for this solution, you will get a good solution near the airfoil, but if you are interested in the wake downstream of the airfoil, your solution will quickly degrade as the cells get very coarse downstream of the trailing edge.
Another common issue is the trailing edge itself. The airfoil you are considering might have a sharp TE or a blunt TE. A sharp TE can be very difficult to resolve with high quality cells with an O-grid or H-grid. However, a C-grid is very amenable to a sharp TE.
However, a blunt TE is very difficult for a C-grid if you can't insert an additional grid to emanate from the TE itself.
Usually a mesh is described as either algebraic or elliptical. An algebraic grid uses simple algebraic equations to place the points. Basically, any point can be calculated directly. An elliptical grid generator sets up an elliptical partial differential equation to arrange the points. In this way, the all the boundaries influence the exact placement of all the points. this is more complex and computationally expensive, but it can produce a very smooth and high quality mesh.
All of these images were pulled from a PDF of Numerical Grid Generation. This book used to be available freely online from a site at Mississippi State University, but I can't find a link to it anymore.