I don't know if this is the most elegant way, but I would create that grid overlay with the grid effect on a solid. Once I got that aligned I would export the frame where the line animation should start from AE. I would bring that frame into illustrator and make my lines there and get them lined up. While I'm there in AI, I would possibly create a matte shape for the outside squares that will contain the darkened images. Put everything on its own layer.
Import that AI into AE. Animate a mask on the lines.
There are a million ways to make those outside images darker, but in my impromptu way, I would make an adjustment layer with a levels or curves to darken. Put the matte shape I created in AI above it. Set the Track Matte of the adjustment layer to Alpha Matte and then use the matte shape layer's opacity to animate the darkening.