In-universe explanation
This is explained in the film's official novelisation, co-authored by Dean Devlin, ID4's producer.
The flashing lights were supposed to be an attempt to communicate with the aliens and to demonstrate our desire for peaceful co-existence:
The president picked up a remote control and switched on the
television. The Apache had just reached the front of the huge
spaceship and turned on its light boards. The powerful lights began to
flash on and off, creating a repeating sequential pattern. The staff
at SETI, alter several hours of furious on-line discussion and a
blizzard of foxes, had come up with a simple mathematical progression,
a message written in what they hoped would be a universally
comprehensible language.
The entire sequence would repeat every three
minutes, followed by a display of the word “peace”’ written in ten
different earthly languages. It wasn’t much, but it was a beginning.
Out-of-universe explanation
Echoing djmadscribbler's answer, the effect was presumably a riff off the lightboard depicted in Close Encounters, a film that Dean Devlin described, in this interview as being one of his favourites:
Devlin: I don't know what the future holds. My passions have been for mainstream, popcorn movies. That's what I usually go to see on a
Friday night. I fell in love with the movies by watching Star Wars,
or Jaws, or Close Encounters of the Third Kind. One day, I hope to
make a film as great as those.