Groundig unused atmega328 pins?

"In sleep mode the 328 and other AVR microcontrollers disconnect the input circuitry from the pins and grounds the input inverter, so none of this is an issue in sleep mode."

That may be true for inputs - outputs are still driven.

I have a remote control that uses keypad.h library.
I was using diodes with anodes to interrupt and cathodes to keypad row pins to create an interrupt to wake up from power down sleep mode.
Couldn't make it work - turns out the keypad library was leaving the column pins high. As part of going to sleep, I had to write the column pins low so a cathode would get pulled low when a key was pressed connecting a row to a column, and then write them back high on waking up.

Atmel recommends taking unused pins High or Low so they don't oscillate. I define all unused pins as inputs with internal pullups enabled.