The term junction box doesn't describe a particular type of electrical box, it describes a particular application of electrical boxes. Junction boxes hold wire connections, such as a point where a circuit diverts to a switch or a receptacle along its path.
Additionally, a junction box might serve as the jumping off point for a cable that supplies several electrical fixtures. Electricians regularly use switch, receptacle and light box fixtures to wire junctions; however, this is only acceptable if the box is large enough to safely house all the wires.
The primary requirement for junction boxes is that they remain permanently accessible. According to most building codes, the phrase "permanently accessible" means that the junction box is clearly visible and serviceable without removing any walls, ceilings or building materials.
Concealed junction boxes are easily forgotten and therefore pose a great danger to the home's occupants. However, the accessibility requirements do not prohibit you from installing a junction box in the attic.
A common solution to accessibility problem is to have the box open to the underlying room's ceiling. To soften the box's appearance, you may install a low-profile face plate and paint the cover to match your ceiling.