It's based on citizenship. The Danish national statistics agency has an official set of Western countries used when e.g. comparing Denmark to other Western countries. They also define 1st and 2nd generation immigrants
The Danish politicians just reuse these bureaucratic definitions (1st and 2nd gen from non-Western countries).