Draw the grid last with depth masking disabled. That should have no ill effects otherwise as far as I can tell except from some exceptional cases (axis lines over grid) but this is hardly annoying. Generally to properly solve such issues we need to have a better render pipeline with wire objects/materials being drawn after compositing. This is not impossible but for now doing it the simple way.