The simplest solution is by far too work with 32x32-pixel blocks and avoid addressing individual attributes altogether, but even that goes down the drain if you have vertical scrolling (and don't want to skip 16 scanlines of your map every 240).
If you do want free access to the individual 16x16-pixel areas though, it's just a matter of translating coordinates into screen space and bit masks. Much like you need to convert world coordinates into name table addresses to modify tiles, you can calculate attribute table addresses in a similar way. NT addresses have the following format:
Code:
0010NNYY YYYXXXXX
NN: 00, 01, 10 or 11, one of the 4 name tables;
YYYYY: 0 to 29, vertical position of the tile;
XXXXX: 0 to 31, horizontal position of the tile;
AT addresses on the other hand are arranged like this:
Code:
0010NN11 11YYYXXX
NN: 00, 01, 10 or 11, one of the 4 name tables;
YYY: 0 to 7, vertical position of the attribute block;
XXX: 0 to 7, horizontal position of the attribute block;
The important thing to note here is that while name tables have 5 bits for the coordinates, attribute tables only have 3. 1 bit is obviously lost because tiles are 8x8 pixels while attributes affect 16x16-pixel areas. The other missing bit is not part of the address because it's not supposed to address bytes, but bits within the selected attribute byte.
By combining the lower bit of the vertical coordinate with the lower bit of the horizontal coordinate you can form a number between 0 and 3, which will indicate which of the four corners of the attribute byte you're supposed to access. You can use this number to form the bit masks to manipulate the attribute bytes like rainwarrior explained.
One drawback of manipulating individual 16x16-pixel areas is that you need to read the attribute bytes, modify only the necessary bits and write the values back. That would be a pain to do considering our limited VRAM bandwidth during vblank, so one common solution is to buffer the attribute tables in RAM, so they are always accessible for modifications.